package com.financing.platform.vo;

import java.util.Date;

import com.financing.platform.common.CsvExportable;
import com.financing.platform.util.DateUtil;
import com.financing.platform.util.StringUtil;



/**
 * 认证用户清单-报表VO
 * @author lisu
 *
 */
public class AuthUserDetailedListVO extends BaseVO implements CsvExportable{

	/**
	 * 
	 */
	private static final long serialVersionUID = -4249746264595045604L;
	
	private Integer id; //序号
	private String userId; //用户id
	private Date createDate; //注册时间
	private String uName; //姓名
	private Date authDate; //认证时间
	private Integer sourceCode ;//邀请人
	private String uCompanyAdd;//公司地址
	private String uJob;//公司职位
	private Integer loginCount;//登录次数
	private Date lastLoginTime;//最后登录时间
	private String mediaSource;//媒体来源
	private String activitiesSource;//活动来源
	private String createDateStart;
	private String createDateEnd;
	private String authDateStart;
	private String authDateEnd;
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public String getUserId() {
		return userId;
	}
	public void setUserId(String userId) {
		this.userId = userId;
	}
	public Date getCreateDate() {
		return createDate;
	}
	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}
	public String getuName() {
		return uName;
	}
	public void setuName(String uName) {
		this.uName = uName;
	}
	public Date getAuthDate() {
		return authDate;
	}
	public void setAuthDate(Date authDate) {
		this.authDate = authDate;
	}
	public Integer getSourceCode() {
		return sourceCode;
	}
	public void setSourceCode(Integer sourceCode) {
		this.sourceCode = sourceCode;
	}
	public String getuCompanyAdd() {
		return uCompanyAdd;
	}
	public void setuCompanyAdd(String uCompanyAdd) {
		this.uCompanyAdd = uCompanyAdd;
	}
	public String getuJob() {
		return uJob;
	}
	public void setuJob(String uJob) {
		this.uJob = uJob;
	}
	public Integer getLoginCount() {
		return loginCount;
	}
	public void setLoginCount(Integer loginCount) {
		this.loginCount = loginCount;
	}
	public Date getLastLoginTime() {
		return lastLoginTime;
	}
	public void setLastLoginTime(Date lastLoginTime) {
		this.lastLoginTime = lastLoginTime;
	}
	public String getCreateDateStart() {
		return createDateStart;
	}
	public void setCreateDateStart(String createDateStart) {
		this.createDateStart = createDateStart;
	}
	public String getCreateDateEnd() {
		return createDateEnd;
	}
	public void setCreateDateEnd(String createDateEnd) {
		this.createDateEnd = createDateEnd;
	}
	
	public String getMediaSource() {
		return mediaSource;
	}
	public void setMediaSource(String mediaSource) {
		this.mediaSource = mediaSource;
	}
	public String getActivitiesSource() {
		return activitiesSource;
	}
	public void setActivitiesSource(String activitiesSource) {
		this.activitiesSource = activitiesSource;
	}
	@Override
	public String csvTitle() {
		return "编号,用户ID,注册时间,姓名,通过认证时间,邀请人,公司地址,公司职位,来源,登陆次数,最近登陆时间";
	}
	@Override
	public String toCsvString() {
		StringBuilder builder = new StringBuilder();
		builder.append(getId()).append(",")
		.append(getUserId()).append(",")
		.append(DateUtil.getString(getCreateDate(), DateUtil.DEFAULT_DATE_FORMAT)).append(",")
		.append(checkString(getuName())).append(",")
		.append(DateUtil.getString(getAuthDate(), DateUtil.DEFAULT_DATE_FORMAT)).append(",")
		.append(checkInt(getSourceCode())).append(",")
		.append(checkString(getuCompanyAdd())).append(",")
		.append(checkString(getuJob())).append(",")
		.append(checkGetMediaSource(getMediaSource())).append("|").append(checkGetActivitiesSource(getActivitiesSource())).append(",")
		.append(getLoginCount()).append(",")
		.append(DateUtil.getString(getLastLoginTime(), DateUtil.DEFAULT_DATE_FORMAT)).append(",");
		return builder.toString();
	}
	private String checkGetActivitiesSource(String activitiesSource){
		if("DCWJ".equals(activitiesSource)){
			return "问卷充话费";
		}else if("ZCSHB88".equals(activitiesSource)){
			return "注册送88元红包";
		}else if("SBD300".equals(activitiesSource)){
			return "斯巴达300";
		}
		return "";
	}
	private String checkGetMediaSource(String mediaSource){
		if("PT".equals(mediaSource)){
			return "平台普通注册";
		}else if("YQF".equals(mediaSource)){
			return "亿启发注册";
		}
		return "";
	} 
	/**
	 * checkString
	 * @param status
	 * @return
	 */
	public  String checkString(String status){
		if(StringUtil.isNullOrEmptyStr(status)){
			return "";
		}else{
			return status.replaceAll(",", "，");
		}	
	}
	/**
	 * checkInt
	 * @param status
	 * @return
	 */
	public  String checkInt(Object i){
		if(i == null){
			return "";
		}else{
			return i.toString();
		}	
	}
	public String getAuthDateStart() {
		return authDateStart;
	}
	public void setAuthDateStart(String authDateStart) {
		this.authDateStart = authDateStart;
	}
	public String getAuthDateEnd() {
		return authDateEnd;
	}
	public void setAuthDateEnd(String authDateEnd) {
		this.authDateEnd = authDateEnd;
	}
	
}
